import React from 'react'
import './MyInfo.css'
import '../../Static/font/iconfont.css'
import 'antd-mobile/dist/antd-mobile.css'
import { NavBar, Icon } from 'antd-mobile';
import axios from 'axios'


class MyInfo extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            getMyInfo:[],
            getMyInfo1:[],
            getMyInfo2:[],
            getMyInfo3:[],
            getMyInfo4:[],
            getMyInfo5:[],
            getMyInfo6:[],
        }
    }
    componentDidMount(){
        this.togetMyInfo()
    }
    togetMyInfo = () =>{
        axios({
            url:'api/olife/businessMy/queryMy',
            method:'get',
            data:{}
        }).then(data =>{
            console.log(data);
            console.log(data.data.data[0][12].shop_photo_url);
            console.log(this.state.getMyInfo.shop_name);
            this.setState({
                getMyInfo:data.data.data[0][0],
                getMyInfo1:data.data.data[1][0],
                getMyInfo2:data.data.data[2][0]['count(*)'],
                getMyInfo3:data.data.data[3][0],
                getMyInfo4:data.data.data[4][0],
                getMyInfo5:data.data.data[5][0],
                getMyInfo6:data.data.data[0][12].shop_photo_url,
            })
        })
    }
    tuichu = () => {
        this.props.history.push('/Login')
    }
    tuichu_z = () => {
        this.props.history.push('/Home/MyIncome')
    }
    
    render() {
            return (
                 /* html */
                <div>
                    <div>
                        <NavBar
                        mode="light"
                        icon={<Icon type="left" />}
                        onLeftClick={() => console.log('onLeftClick')}
                        rightContent={[
                            <Icon key="0" type="search" style={{ marginRight: '16px' }} />,
                            <Icon key="1" type="ellipsis" />,
                        ]}
                        >我的主页面</NavBar>
                    </div>
                    <div className='mingcheng clear'>
                        <div className='imgimg'>
                            {console.log(this.state.getMyInfo6)}
                            <img src={'http://172.16.10.144:8863/'+this.state.getMyInfo6} alt=""/>
                        </div>
                        <div className='name_shangjia'>
                            <h2>{this.state.getMyInfo.shop_name}</h2>
                            <h3>类型：中餐</h3>
                        </div>
                        <div className='left_connet'>
                            <h3>完成订单金额数</h3>
                            <h4>{this.state.getMyInfo1.order_money}</h4>
                        </div>
                        <div className='right_connet'>
                            <h3>累计订完成单数</h3>
                            <h4>{this.state.getMyInfo2}</h4>
                        </div>
                    </div>
                    <div className='add_a'>
                        <div className='add_a_left'>
                            <h3>完成完成订单总金额</h3>
                            <h4>{this.state.getMyInfo3.order_money}</h4>
                        </div>
                        <div className='add_a_right'>
                            <h3>昨日完成订单总数</h3>
                            <h4>{this.state.getMyInfo4.order_id}</h4>
                        </div>
                    </div>
                    <div className='add_b clear' onClick={this.tuichu_z}>
                        <div className='add_b_left'>
                            <h3>我的收入</h3>
                        </div>
                        <div className='add_b_right'>
                            <h3>{this.state.getMyInfo5.goods_account_money}<i className='iconfont'>&#xe601;</i></h3>
                        </div>
                    </div>
                    <div className='zxc' onClick={this.tuichu}>
                        <h3>退出登录</h3>
                    </div>
                </div>
            )
    }
}

export default MyInfo